<?php $this->set('title', $thisSurvey['Survey']['name']); ?>

<?php echo $html->link('Surveys', array('controller'=>'Surveys', 'action'=>'index')); ?>

<div class="header"><?php echo($thisSurvey['Survey']['name']); ?></div>
<?php for($i = 0; $i < count($thisSurvey['Question']); $i++) {
	echo('<p>'.($i+1).'. '.$thisSurvey['Question'][$i]['text']."<br />\n");
	echo('<span style="position:relative; left:30px;">');
	
	$index = 0;
	// For each response in the set of responses for the current question...
	foreach($responses[$i] as $possible_response){
		// set to true if the response being iterated over is the one the user selected
		echo(chr(($index++)+65).'. '.$possible_response['Answer']['text']);
		echo('<br>');
	}
	echo('</span>');
	echo('</p>');
} 
?>
<div class="header"><?php echo("Registered Users"); ?></div>
<table>
	<tr>
		<td>Username</td>
		<td>First Name</td>
		<td>Last Name</td>
	</tr>
<?php
for($i = 0; $i < count($registeredUsers); ++$i){
?>
	<tr>
		<td><?php echo $html->link($registeredUsers[$i]['username'], 
			array(	'controller'=>'Users', 
					'action'=>'displayIndividualResults/'.$thisSurvey['Survey']['id'].'/'.$registeredUsers[$i]['id'])); ?>
		</td>
		<td><?php echo($registeredUsers[$i]['firstname']);?></td>
		<td><?php echo($registeredUsers[$i]['lastname']);?></td>
	</tr>
<?php 
}
?>
</table>